import pickle as pk
from loguru import logger


def merge():

    logger.info("Start Merging!")
    # pooling_data = pk.load(open("trace_data_pooling.pkl", "rb"))
    # logger.info("The pooling data is loaded.")
    # shape_data = pk.load(open("trace_data_shape.pkl", "rb"))
    # logger.info("The shape data is loaded.")
    # reshape_data = pk.load(open("trace_data_reshape.pkl", "rb"))
    # logger.info("The reshape data is loaded.")
    # conv3d_data = pk.load(open("trace_data_conv3d.pkl", "rb"))
    # logger.info("The conv3d data is loaded.")
    # merging_data = pk.load(open("trace_data_merging.pkl", "rb"))
    # logger.info("The merging data is loaded.")

    bn_data = pk.load(open("trace_data_bn.pkl", "rb"))
    logger.info("The bn data is loaded.")

    tmp_data = pk.load(open("trace_data_all_v5.pkl", "rb"))
    logger.info("The old data is loaded.")

    # tmp_data.update(pooling_data)
    # tmp_data.update(shape_data)
    # tmp_data.update(reshape_data)
    # tmp_data.update(conv3d_data)
    # tmp_data.update(merging_data)
    tmp_data.update(bn_data)

    pk.dump(tmp_data, open("trace_data_all_v5.pkl", "wb"))
    logger.info("Done!")


if __name__ == "__main__":
    merge()
